package com.movie.modules.jf.controller;

import java.util.Arrays;
import java.util.Map;

import com.movie.modules.jf.service.ActorService;
import com.movie.modules.jf.service.MovieService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.movie.modules.jf.entity.VipEntity;
import com.movie.modules.jf.service.VipService;
import com.movie.common.utils.PageUtils;
import com.movie.common.utils.R;



/**
 * 会员表
 *
 * @author kakarot
 * @email 532050892@qq.com
 * @date 2021-08-20 01:31:10
 */
@RestController
@RequestMapping("/sys/vip")
@Api(tags = "后台会员模块")
public class VipController {
    @Autowired
    private VipService vipService;

    /**
     * 列表
     */
    @GetMapping("/list")
    @ApiOperation("分页查询")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = vipService.queryPage(params);
        return R.ok().put("data", page);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{vipId}")
    @ApiOperation("详细信息")
    public R info(@PathVariable("vipId") Integer vipId){
		VipEntity vip = vipService.getById(vipId);
        return R.ok().put("data", vip);
    }

    /**
     * 删除
     */
    @DeleteMapping("/delete/{vipId}")
    @ApiOperation("删除信息")
    public R delete(@PathVariable("vipId") Integer vipId){
        vipService.delete(vipId);
        return R.ok();
    }

    @PostMapping("/status")
    @ApiOperation("更改状态")
    public R status(@RequestBody VipEntity vip){
        vipService.updateById(vip);
        return R.ok();
    }

    @GetMapping("/movie/{vipId}")
    @ApiOperation("收藏电影列表")
    public R movieList(@PathVariable("vipId") Integer vipId,@RequestParam Map<String, Object> params){
        return R.ok().put("data",vipService.getMovieList(vipId,params));
    }

    @GetMapping("/actor/{vipId}")
    @ApiOperation("关注演员列表")
    public R actorList(@PathVariable("vipId") Integer vipId,@RequestParam Map<String, Object> params){
        return R.ok().put("data",vipService.getActorList(vipId,params));
    }

    @GetMapping("/comment/{vipId}")
    @ApiOperation("发布评论列表")
    public R commentList(@PathVariable("vipId") Integer vipId,@RequestParam Map<String, Object> params){
        return R.ok().put("data",vipService.getCommentList(vipId,params));
    }

}
